<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<c:set var="contextRootPath" value="${pageContext.request.contextPath}" />
<c:if test="${pageContext.request.contextPath == '/'}">
	<c:set var="contextRootPath" value="" />
</c:if>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Thrift接口管理管理后台</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="${contextRootPath}/resource/easyui-themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="${contextRootPath}/resource/easyui-themes/icon.css" />


<script type="text/javascript" src="${contextRootPath}/resource/js/jquery.easyui-1.4.min.js"></script>

<script type="text/javascript">
	var contentIframeHeight = 800;

	function showTab(tabTitle, tabUrl) {
		if ($('#tt').tabs('exists', tabTitle)) {
			$('#tt').tabs('select', tabTitle)

			return;
		}

		$('#tt').tabs(
				'add',
				{
					title : tabTitle,
					content : '<iframe width="100%" height="'
							+ contentIframeHeight
							+ 'px" frameborder="0" scrolling="auto" src="'
							+ tabUrl + '"></iframe>',
					closable : true
				});
	}

	$(document).ready(function() {
		contentIframeHeight = $(document).height() - 70;

		var divHeight = $(document).height() - 30;

		$("#divContent").height(divHeight);
		$("#divLeftMenu").height(divHeight);
		$("#divRightContent").height(divHeight);
		$("#tt").height(divHeight - 25);
	});
</script>

</head>
<body>
	<div align="right">
		welcome, <b><c:out value="${loginTicket}" /></b>! &nbsp;&nbsp;&nbsp;<a href='<c:out value="${contextRootPath}/login/logout.do"/>'>退出</a> &nbsp;&nbsp;&nbsp;
	</div>
	<div id='divContent' class="easyui-layout" style="width: 100%; height: 100%; overflow-x: hidden; overflow-y: hidden">
		<div id='divLeftMenu' data-options="region:'west',split:true" title="菜单" style="width: 200px; overflow-x: hidden; overflow-y: hidden">

			<c:set var="permissionIceTest" value="false"></c:set>
			<c:set var="permissionMemcacheTest" value="false"></c:set>
			<c:set var="permissionRedisTest" value="false"></c:set>
			<c:set var="permissionKafkaTest" value="false"></c:set>
			<c:set var="permissionIceServer" value="false"></c:set>
			<c:set var="permissionIceInstance" value="false"></c:set>
			<c:set var="permissionUrlMapping" value="false"></c:set>
			<c:set var="permissionMethodInfo" value="false"></c:set>
			<c:set var="permissionMerchantInfo" value="false"></c:set>
			<c:set var="permissionMerchantPermission" value="false"></c:set>
			<c:set var="permissionIceLog" value="false"></c:set>
			<c:set var="permissionStatConsumeDateApiData" value="false"></c:set>
			<c:set var="permissionStatConsumeHourApiData" value="false"></c:set>
			<c:set var="permissionStatRequestDateApiData" value="false"></c:set>
			<c:set var="permissionStatRequestHourApiData" value="false"></c:set>
			<c:set var="permissionGatewayLog" value="false"></c:set>
			<c:set var="permissionConfigInfo" value="false"></c:set>
			<c:set var="permissionErrorCode" value="false"></c:set>
			<c:set var="permissionPermissionInfo" value="false"></c:set>
			<c:set var="permissionAdminInfo" value="false"></c:set>

			<c:set var="permissionIceTestCase" value="false"></c:set>

			<c:forEach items="${userPermissionUriWithoutContextSet}" var="permissionUri">
				<c:if test="${permissionUri == '/bs/icetest/index.do'}">
					<c:set var="permissionIceTest" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/memcachetest/index.do'}">
					<c:set var="permissionMemcacheTest" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/redistest/index.do'}">
					<c:set var="permissionRedisTest" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/test/kafkatest/index.do'}">
					<c:set var="permissionKafkaTest" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/iceservice/list.do'}">
					<c:set var="permissionIceServer" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/iceinstance/list.do'}">
					<c:set var="permissionIceInstance" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/urlmappinginfo/list.do'}">
					<c:set var="permissionUrlMapping" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/methodinfo/list.do'}">
					<c:set var="permissionMethodInfo" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/merchantkey/list.do'}">
					<c:set var="permissionMerchantInfo" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/merchantapipermission/list.do'}">
					<c:set var="permissionMerchantPermission" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/consumelog/list.do'}">
					<c:set var="permissionIceLog" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/consumelog/statconsumedateapidata/list.do'}">
					<c:set var="permissionStatConsumeDateApiData" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/consumelog/statconsumehourapidata/list.do'}">
					<c:set var="permissionStatConsumeHourApiData" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/requestlog/statrequestdateapidata/list.do'}">
					<c:set var="permissionStatRequestDateApiData" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/requestlog/statrequesthourapidata/list.do'}">
					<c:set var="permissionStatRequestHourApiData" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/requestlog/list.do'}">
					<c:set var="permissionGatewayLog" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/config/config/list.do'}">
					<c:set var="permissionConfigInfo" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/config/errorcode/list.do'}">
					<c:set var="permissionErrorCode" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/admin/threshold/list.do'}">
					<c:set var="permissionAlertThreShold" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/admin/permission/list.do'}">
					<c:set var="permissionPermissionInfo" value="true"></c:set>
				</c:if>
				<c:if test="${permissionUri == '/bs/admin/userinfo/list.do'}">
					<c:set var="permissionAdminInfo" value="true"></c:set>
				</c:if>

				<c:if test="${permissionUri=='/bs/icetestcase/list.do'}">
					<c:set var="permissionIceTestCase" value="true"></c:set>
				</c:if>

			</c:forEach>


			<ul class="easyui-tree">
				<c:if test="${superAdmin || permissionConfigInfo || permissionAlertThreShold || permissionErrorCode}">
					<li data-options="state:'closed'"><span>配置信息</span>
						<ul>
							<c:if test="${superAdmin || permissionConfigInfo}">
								<li><span> <a href="javascript:showTab('配置信息', '../bs/config/config/list.do');">配置信息</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionAlertThreShold}">
								<li><span><a href="javascript:showTab('警报阀值', '../bs/admin/threshold/list.do');">警报阀值</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionErrorCode}">
								<li><span> <a href="javascript:showTab('错误码信息', '../bs/config/errorcode/list.do');">错误码信息</a></span></li>
							</c:if>
						</ul></li>
				</c:if>

				<c:if
					test="${superAdmin || permissionIceLog || permissionGatewayLog || permissionStatConsumeDateApiData || permissionStatConsumeHourApiData || permissionStatRequestDateApiData || permissionStatRequestHourApiData }">
					<li data-options="state:'closed'"><span>日志查询</span>
						<ul>
							<c:if test="${superAdmin || permissionIceLog}">
								<li><span><a href="javascript:showTab('Thrift耗时日志', '../bs/consumelog/list.do');">Thrift耗时日志</a></span></li>
								<li><span><a href="javascript:showTab('Thrift耗时统计(接口/结果)', '../bs/consumelogstat/statByApiCode.do');">Thrift耗时统计(接口/结果) </a></span></li>
								<li><span><a href="javascript:showTab('Thrift耗时统计(结果)', '../bs/consumelogstat/statByCode.do');">Thrift耗时统计(结果)</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionStatConsumeDateApiData}">
								<li><span><a href="javascript:showTab('Thrift按日期的接口统计数据', '../bs/consumelog/statconsumedateapidata/list.do');">Thrift按日期的接口统计数据</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionStatConsumeHourApiData}">
								<li><span><a href="javascript:showTab('Thrift按小时的接口统计数据', '../bs/consumelog/statconsumehourapidata/list.do');">Thrift按小时的接口统计数据</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionGatewayLog}">
								<li><span><a href="javascript:showTab('GateWay请求日志', '../bs/requestlog/list.do');">GateWay请求日志</a></span></li>
								<li><span><a href="javascript:showTab('GateWay请求统计(接口/verify结果)', '../bs/requestlogstat/statByMethodCode.do');">GateWay请求统计(接口/verify结果)</a></span></li>
								<li><span><a href="javascript:showTab('GateWay请求统计(verify结果)', '../bs/requestlogstat/statByCode.do');">GateWay请求统计(verify结果) </a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionStatRequestDateApiData}">
								<li><span><a href="javascript:showTab('GateWay按日期的接口统计数据', '../bs/requestlog/statrequestdateapidata/list.do');">GateWay按日期的接口统计数据</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionStatRequestHourApiData}">
								<li><span><a href="javascript:showTab('GateWay按小时的接口统计数据', '../bs/requestlog/statrequesthourapidata/list.do');">GateWay按小时的接口统计数据</a></span></li>
							</c:if>
						</ul></li>
				</c:if>

				<c:if
					test="${superAdmin || permissionIceTest || permissionMemcacheTest || permissionRedisTest|| permissionKafkaTest || permissionIceTestCase }">
					<li data-options="state:'closed'"><span>测试工具</span>
						<ul>
							<c:if test="${superAdmin || permissionIceTest}">
								<li><span><a href="javascript:showTab('Thrift测试工具', '../bs/icetest/index.do');">Thrift测试工具</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionIceTestCase}">
								<li><span><a href="javascript:showTab('Thrift测试用例', '../bs/icetestcase/list.do');">Thrift测试用例</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionMemcacheTest}">
								<li><span><a href="javascript:showTab('Memcache测试工具', '../bs/memcachetest/index.do');">Memcache测试工具</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionRedisTest}">
								<li><span><a href="javascript:showTab('Redis测试工具', '../bs/redistest/index.do');">Redis测试工具</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionKafkaTest}">
								<li><span><a href="javascript:showTab('Kafka测试工具', '../bs/test/kafkatest/index.do');">Kafka测试工具</a></span></li>
							</c:if>
						</ul></li>
				</c:if>
				<c:if test="${superAdmin || permissionIceServer || permissionIceInstance || permissionUrlMapping || permissionMethodInfo || permissionMerchantInfo || permissionMerchantPermission || permissionMethodWhiteList}">
					<li data-options="state:'closed'"><span>Thrift模块配置信息</span>
						<ul>
							<c:if test="${superAdmin || permissionIceServer}">
								<li><span><a href="javascript:showTab('Thrift模块信息', '../bs/iceservice/list.do');">Thrift模块信息</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionIceInstance}">
								<li><span><a href="javascript:showTab('Thrift模块实例信息', '../bs/iceinstance/list.do');">Thrift模块实例信息</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionUrlMapping}">
								<li><span><a href="javascript:showTab('URL映射信息', '../bs/urlmappinginfo/list.do');">URL映射信息</a></span></li>
							</c:if>
							
							<c:if test="${superAdmin || permissionMethodInfo}">
								<li><span><a href="javascript:showTab('方法信息', '../bs/methodinfo/list.do');">方法信息</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionMerchantInfo}">
								<li><span><a href="javascript:showTab('商户信息', '../bs/merchantkey/list.do');">商户信息</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionMerchantPermission}">
								<li><span><a href="javascript:showTab('商户API权限信息', '../bs/merchantapipermission/list.do');">商户API权限信息</a></span></li>
							</c:if>
						</ul></li>
				</c:if>

				<c:if test="${superAdmin || permissionPermissionInfo || permissionAdminInfo}">
					<li data-options="state:'closed'"><span>权限管理</span>
						<ul>
							<c:if test="${superAdmin || permissionPermissionInfo}">
								<li><span><a href="javascript:showTab('权限信息', '../bs/admin/permission/list.do');">权限信息</a></span></li>
							</c:if>
							<c:if test="${superAdmin || permissionAdminInfo}">
								<li><span><a href="javascript:showTab('管理员信息', '../bs/admin/userinfo/list.do');">管理员信息</a></span></li>
							</c:if>
						</ul></li>
				</c:if>

			</ul>

		</div>
		<div id='divRightContent' data-options="region:'center',title:'',iconCls:'icon-ok'" style="width: 100%;; overflow-x: hidden; overflow-y: hidden">
			<div id="tt" class="easyui-tabs" style="width: 100%; height: 100%; overflow-x: hidden; overflow-y: hidden"></div>
		</div>
	</div>
</body>
</html>
